import {message} from "antd";
import {ErrorType} from "@/utils/errCode";

export function headerConfig() {
    const imToken = localStorage.getItem("connection-imtoken");
    if (!imToken) {
        message.error('登录失效，请重新跳转');
    }
    return {
        "Operationid": new Date().getTime(),
        "Token": imToken
    };
}


export const responseIntercept = (response) => {
    if (200 != response.status) {
        message.error("网络错误")
    }
    if (0 != response.data.errCode) {
        const msg = ErrorType.getMessage(response.data.errCode);
        message.error(msg)
    }
    return response;
}
